package gui.frame;

import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class FrameIdea extends Frame {

	Button btn1 = new Button("Button 1");
	Button btn2 = new Button("Button 2");

	FrameIdea() {
		this.setLayout(new FlowLayout());
		btn1.addActionListener(new BL1());
		btn2.addActionListener(new BL2());

		this.add(btn1);
		this.add(btn2);
	}

	class BL1 implements ActionListener {

		@Override
		public void actionPerformed(ActionEvent e) {
			System.out.println("Button 1 Pressed");
		}

	}
	
	class BL2 implements ActionListener{

		@Override
		public void actionPerformed(ActionEvent e) {
			System.out.println("Button 2 Pressed");
		}
		
	}
	
	public static void main(String[]args){
		Frame frame=new FrameIdea();
		frame.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent e){
				System.out.println("Window Closing");
				System.exit(0);
			}
		});
		
		frame.setSize(300, 200);
		frame.setVisible(true);
	}
}
